package com.fujitsu.cn.fnst.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.fujitsu.cn.fnst.base.BaseDao;
import com.fujitsu.cn.fnst.entiy.Meeting;

@Repository
public class MeetingDao extends BaseDao<Meeting> {
    // WeakReference<List<Meeting>> mettings = null;
    public List<Meeting> findByWhereAndOrder(String where, String order) {
        // if (where == null && order == null) {
        // if (mettings != null && mettings.get() != null) {
        // return mettings.get();
        // }
        // List<Meeting> list = query4Page(Meeting.class, null, null, false,
        // 0, 1000);
        // mettings = new WeakReference<List<Meeting>>(list);
        // return list;
        // }
        return query4Page(Meeting.class, order, where, false, 0, 1000);
    }

    public List<Meeting> findByFilter(String where) {
        if (where == null) {
            List<Meeting> list = query4Page(Meeting.class, null, null, false,
                    0, 1000);
            return list;
        }
        return query4Page(Meeting.class, null, " 1=1 " + where, false, 0,
                1000);
    }

    public List<Meeting> findByUserRight(int right) {
        return findByFilter("meetingRight <=" + right);
    }
}
